package com.iwe3.protal.controller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

@RequestMapping("/page")
@Controller
public class PageController {
    @RequestMapping("/toShoppingCar")
    public String toShoppingCar(){
        return "pages/shoppingcar";
    }

    @RequestMapping("/toLogin")
    public String toLogin(){
        return "login";
    }

    //完整路径：page/toBookDetail -> PageController#toBookDetail()
    @RequestMapping("/toBookDetail")
    public String toBookDetail(@RequestParam("bookId") int bookId, Model model){
       model.addAttribute("bookId",bookId);
       return "pages/bookdetail";
    }


    @RequestMapping("/toIndex")
    public String toIndex() {
        return "index";
    }

    //完整路径：page/toBookList -> PageController#toBookList()
    @RequestMapping("/toBookList")
    public String toBookList(@RequestParam("typeId") int typeId, Model model){
        model.addAttribute("typeId",typeId);
        return "pages/booklist";
    }

}